package ynu.beggar.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ynu.beggar.server.entities.DO.BulletinDO;
import ynu.beggar.server.service.AdminService;
import ynu.beggar.server.utils.JsonData;

@RestController
@RequestMapping(path = "/api/v1/admin", produces = "application/json;charset=UTF-8")
@CrossOrigin(origins = "*")
public class AdminController {

    private AdminService adminService;

    @Autowired
    private void setBulletinDao(AdminService adminService) {
        this.adminService = adminService;
    }

    @PostMapping(path = "/newBulletin", consumes = {"application/json"})
    public JsonData newBulletin(@RequestBody BulletinDO bulletinDO) {
        return adminService.createBulletin(bulletinDO);
    }
}
